function check1() {
    if (l_form.username.value == "") {
        alert("请输入用户名!");
        l_form.username.focus();
        return;
    } else if (l_form.password.value == "") {
        alert("请输入用户密码！");
        l_form.password.focus();
        return;
    } else if (l_form.imageCode.value == "") {
        alert("请输入验证码！");
        l_form.imageCode.focus();
        return;
    } else if (l_form.username.value != "liuyueyan") {
        alert("请输入正确的用户名！");
        l_form.username.focus();
        return;
    } else if (l_form.password.value != "123456") {
        alert("请输入正确的用户密码！");
        l_form.password.focus();
        return;
    } else if (l_form.imageCode.value != "uwv6") {
        alert("请输入正确的的验证码")
        l_form.imageCode.focus();
        return;
    } else {
        l_form.submit();
        location.href = 'Manage.html';
    }
}

function check2() {
    if (l_form.username.value == "") {
        alert("请输入用户名!");
        l_form.username.focus();
        return;
    } else if (l_form.name.value == "") {
        alert("请输入用户姓名！");
        l_form.name.focus();
        return;
    } else if (l_form.password1.value == "") {
        alert("请输入用户密码！");
        l_form.password1.focus();
        return;
    } else if (l_form.password2.value == "") {
        alert("请再次输入确认用户密码！");
        l_form.password2.focus();
        return;
    } else if (l_form.password1.value != l_form.password2.value) {
        alert("两次输入密码不一致！");
        l_form.password2.focus();
        return;
    } else if (l_form.email.value == "") {
        alert("请输入邮箱！");
        l_form.email.focus();
        return;
    } else if (l_form.phonenumber.value == "") {
        alert("请输入手机号码！");
        l_form.phonenumber.focus();
        return;
    } else if (l_form.work.value == "") {
        alert("请输入所在单位！");
        l_form.work.focus();
        return;
    } else if (l_form.imageCode.value == "") {
        alert("请输入验证码！");
        l_form.imageCode.focus();
        return;
    } else if (l_form.imageCode.value != "uwv6") {
        alert("请输入正确的的验证码!")
        l_form.imageCode.focus();
        return;
    } else if (!IsEmail(document.getElementById("email").value)) {
        alert("邮箱地址格式错误!");
        document.getElementById("email").focus();
        return;
    }
    if (!isTelCode(document.getElementById("phonenumber").value)) {
        alert("电话号码格式有误！");
        l_form.phonenumber.focus();
        return;
    } else {
        l_form.submit();
        alert("注册成功");
        location.href = 'Login.html';
    }
}

function isTelCode(str) {
    var reg = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
    return reg.test(str);
}

function IsEmail(str) {
    var reg = /^\w+@[a-zA-Z0-9]{2,10}(?:\.[a-z]{2,4}){1,3}$/;
    return reg.test(str);
}